// 1. 引入异步对象
import request from '@/utils/request'
import type {CategoryListModel } from '@/api/product/model/categoryModel'
// 2. 使用枚举来统一管理接口
enum Api {
  // 1. 获取一级分类
  getCategory1ListApi = '/admin/product/getCategory1',
  // 2. 获取二级分类
  getCategory2ListApi = '/admin/product/getCategory2',
  // 3. 获取三级分类
  getCategory3ListApi = '/admin/product/getCategory3'
}

// 3. 写接口函数
// 3.1 获取一级导航分类数据
export const reqGetCategory1ListData = () => request.get<any,CategoryListModel>(Api.getCategory1ListApi)

// 3.2 获取二级导航分类数据
export const reqGetCategory2ListData = (category1Id:number)=> request.get<any,CategoryListModel>(Api.getCategory2ListApi+`/${category1Id}`)
// 3.3 获取三级导航分类数据
export const reqGetCategory3ListData = (category2Id:number)=> request.get<any,CategoryListModel>(Api.getCategory3ListApi+`/${category2Id}`)